package cn.coderliu.consumer.listener;


import org.springframework.stereotype.Component;

/**
 * 监听的队列名称 TestDirectQueue
 */
@Component
public class DirectReceiver {

//    @RabbitHandler
//    @RabbitListener(queues = "TestDirectQueue")
//    public void process(Message message, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long tag) throws Exception {
//        Map map = JSON.parseObject(new String(message.getBody(), "utf-8"), Map.class);
//        System.out.println(message.toString());
//        //   System.out.println("DirectReceiver消费者收到消息  : " + new String(message.getBody(), "utf-8"));
//        try {
//            //手动接收
//            channel.basicAck(tag, false);
//            //手动拒绝放回队列
//            //     channel.basicNack(tag,false,true);
//        } catch (IOException e) {
//            e.printStackTrace();
//            channel.basicNack(tag,false,true);
//        }
//    }

}
